package testPaperCTCS;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import static testPaperCTCS.GuessTestingPaperActivity.InforGuessTesting;

/**
 * 自定义fragment适配器
 * @author WGL
 *
 */
public class GuessTestingPaperFragmentAdapter extends FragmentPagerAdapter {

    private long flag = 0;

    public GuessTestingPaperFragmentAdapter(FragmentManager fm) {
        super(fm);
    }
    @Override
    public int getCount() {
        int sumCount = 0 ;
        if(InforGuessTesting != null){
            sumCount = InforGuessTesting.getPaperContent().size();
//            Log.e("===getCount==","======sumCount======"+sumCount);
        }
        return sumCount;
    }
    @Override
    public Fragment getItem(int position) {
        return GuessTestingPaperFragment.newInstance(position);
    }

//    @Override
//    public int getItemPosition(Object object) {
//        // 最简单解决 notifyDataSetChanged() 页面不刷新问题的方法
//        return POSITION_NONE;
//    }

    @Override
    public long getItemId(int position) {
        return position + flag;
    }

    public void paperHasSubmit(){
        flag = System.currentTimeMillis();
    }

}
